package com.mouse.hxsj.entity.common;

import com.mouse.hxsj.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class Point {
    private int num;
    private int x;
    private int y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    public static Point init(String str) {
        String[] split = str.split(",");
        if (split.length != 2) return null;
        Integer x = StringUtil.toInt(split[0]);
        Integer y = StringUtil.toInt(split[1]);
        if (x == null || y == null) return null;
        return new Point(0,x, y);
    }
}
